package com.jack.payment.controller.admin.auth;

import com.jack.payment.entity.common.CommonAskParam;
import com.jack.payment.entity.filter.CommonPaging;
import com.jack.payment.entity.common.CommonResult;
import com.jack.payment.entity.generate.user.UserModel;
import com.jack.payment.service.basic.impl.HomeServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Tag(name = "首页数据")
@RequestMapping("/api/v1/home")
public class HomeController {
    private Logger log = LoggerFactory.getLogger(HomeController.class);

    @Autowired
    private HomeServiceImpl homeService;

    @Operation(summary = "获取各交易额GMV")
    @RequestMapping(value = "getHomeGMV", method = {RequestMethod.POST})
    @ResponseBody
    public CommonResult getHomeGMVData(@RequestBody CommonAskParam<CommonPaging> data) {
        UserModel getUser = (UserModel) data.getCommon().getUserId();
        CommonPaging filter = new CommonPaging();
        filter.setUserId(getUser.getId());
        return CommonResult.ok(homeService.getPayGmvDetail(filter));
    }
}
